package com.loser.module.room.service.impl;

import com.loser.module.room.entity.Room;
import com.loser.module.room.service.RoomService;
import com.loser.module.user.entity.User;
import com.loser.module.user.service.UserService;
import io.github.loserya.core.sdk.impl.MogoServiceImpl;
import io.github.loserya.module.datasource.MongoDs;
import io.github.loserya.module.logic.IgnoreLogic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 房间 服务类
 *
 * @author loser
 * @date 2023-08-05 20:26:45
 */
@Service
@MongoDs("slave_1")
@IgnoreLogic
public class RoomServiceImpl extends MogoServiceImpl<String, Room> implements RoomService {

    @Autowired
    @Lazy
    private UserService userService;

    @Override
    @MongoDs("slave_2")
    public Room getById(String id) {
//        User byId = userService.getById(id);
//        User byId1 = userService.getById(id);
        return super.getById(id);
    }

    @Override
    @MongoDs("slave_2")
    public List<Room> listByDs1() {
        User byId = userService.getById("1");
        User byId1 = userService.getById("1");
        return super.list();
    }
}
